package com.coding.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * @author Cynicism
 * @version 1.0
 * @project ChatDemo
 * @description
 * @date 2024/6/22 10:28:55
 */
@Mapper
public interface FollowMapper {
    @Insert("INSERT INTO user_followers (follower_id, followee_id) VALUES (#{followerId}, #{followeeId})")
    Integer insert(@Param("followerId") Long followerId, @Param("followeeId") Long followeeId);

    @Select("SELECT 1 FROM user_followers WHERE user_id = #{followerId} AND followee_id = #{followeeId} LIMIT 1")
    Integer isFollowing(@Param("followerId") Long followerId, @Param("followeeId") Long followeeId);
}
